﻿using System;
using System.Collections.Generic;

namespace Pharma
{
     public class MedicineCatalog
    {
        public List<Medicine> list = new List<Medicine>();
        public  void Accept(int n)
        {
            for (int i = 0; i < n; i++)
            {
                Medicine me = new Medicine();
                me.Accept(); // den day chi moi co du lieu, medicine chua dc add vao list
                list.Add(me);  // add vao lists         
            }
        }
        public void Refresh(int code)
        {
            foreach (var item in list)
            {
                if (item.medicineCode == code && item.quantityOnHand == 0)
                {
                    item.quantityOnHand += 50;
                }
            }
        }
        public  void Print(int code)
        {
            foreach (var item in list)
            {
                if (item.medicineCode.Equals(code))
                {
                    item.Print();
                }
            }
        }
        public  void Print(DateTime manuDate, DateTime exDate)
        {
            foreach (var item in list)
            {
                if (item.expiryDate.Equals(exDate) && item.manufacturedDate.Equals(manuDate))
                {
                    item.Print();
                }
            }
        }
    }
}
